import java.math.BigDecimal;
import java.util.Scanner;

public class TestDay32 {

    //淘宝网店
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int year1 = scanner.nextInt();//年
            int month1 = scanner.nextInt();//月
            int day1 = scanner.nextInt();//日\
            int year2 = scanner.nextInt();//年
            int month2 = scanner.nextInt();//月
            int day2 = scanner.nextInt();//日\
            int[]p = {0,31*2,28,31,30*2,31,30*2,31,31*2,30*2,31*2,30,31*2};
            //判断是否是闰年
            //
            //2 3 5 7 11 素月
            //如果年份相同并且都是闰年
            int sum = 0;//记录钱数
            day1--;
            //如果是同一年
            if(year1 == year2){
                //如果是闰年就置为29天
                if(func(year1)){
                    p[2] = 29;
                }
                //如果是质数月就减数双倍
                if(month1 == month2){
                    //如果是在同一个月的话
                    //判断是否是素月
                    if(func2(month1)){
                        sum = (day2-day1)*2;
                    }else {
                        sum = (day2-day1);
                    }
                }else {
                    for (int i = month1; i < month2; i++) {
                        sum+=p[i];
                    }
                    //如果不在同一个月
                    if(func2(month2)){
                        day2*=2;
                        //如果是素月
                    }
                    if(func2(month1)){
                        day1 = day1*2;
                    }
                    //2000 1 1 2000 1 31
                    //2000 2 1 2000 2 29
                    sum = sum + day2 - day1;

                }
            }else {
                //如果不是同一年
                //判断year2和year1"之间"有几个闰年
                int z = 0;//记录闰年个数,
                for (int i = year1+1; i < year2 ; i++) {
                    if(func(i)){
                        z++;
                    }
                }
                //先把间隔的年数记录
                //记录一整年有多少天
                for (int i = 1; i < p.length; i++) {
                    sum+=p[i];
                }
                //2012 2013
                sum = sum*(year2-year1-1)+z;//记录相隔年数的天数
                //记录他们相差几年
                //
                //
                //如果是闰年就置为29天
                if(func(year1)){
                    p[2] = 29;
                }

                for (int i = month1; i < p.length ; i++) {
                    //记录从当前月份的后一个月份到12月的天数
                    sum = sum + p[i];
                }

                if(func2(month1)){
                    //如果不是素月
                    sum = sum-day1*2;
                }else {
                    sum = sum-day1;
                }
                if(!func(year2)){
                    //如果不是闰年就置为28
                    p[2] = 28;
                }
                for (int i = month2-1; i >= 1 ; i--) {
                    //记录从当前月份的后一个月份到12月的天数
                    sum = sum + p[i];
                }

                if(func2(month2)){
                    //如果不是素月
                    sum = sum+day2*2;
                }else {
                    //不是素月
                    sum = sum+day2;
                }

            }
            System.out.println(sum);

        }


    }
    public static boolean func(int year1){
        return year1 % 400 == 0 || (year1 % 4 == 0 && year1 % 100 != 0);
    }
    public static boolean func2(int month){
        int[]array = {1,4,6,8,9,10,12};
        for (int p:array) {
            if(p == month){
                return true;
            }
        }
        return false;

    }

    //斐波那契凤尾
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] array = new int[100001];
        array[0] = 1;
        array[1] = 1;
        for (int i = 2; i <= 100000; i++) {
           //如果值超过6位后,只需要让后六位进行相加就好
           array[i] = (array[i-2]+array[i-1])%1000000;

        }
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            //求第N为的斐波那契数
            System.out.printf(n>29? "%06d\n":"%d\n",array[n]);
        }
    }
}
